<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>添加代办授权</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
	<script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
	<script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
	<script type='text/javascript'>
		var api = frameElement.api, W = api.opener;
		function selectperson(type){
			var obj = window.showModalDialog("<%=request.getContextPath()%>/resource/choose/selectUserone.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=700px;dialogHeight=500px");
			if (type=='source'){
				document.getElementById("sourcepersonname").value = obj.username;
				document.getElementById("sourcepersonid").value = obj.userid;
			}
			else{
				document.getElementById("targetpersonname").value = obj.username;
				document.getElementById("targetpersonid").value = obj.userid;
			}
		}
		
		var options = {
	    	    url:'<%=basePath%>rightGiveAction!saveRightGive.action',
	    	    dataType:'json',
	    	    success: function(data) {
	    	      if(data.result=='success'){
						alert("添加成功！");
						api.close();
						W.gridSearch();
	    	      }else{
						alert("添加失败，请重试！");
						api.close();
		    	  }
	    }};
	    	    
		function queren(){
			$('#pageFrom').ajaxSubmit(options);
		}
	</script>
  </head>
  
  <body style='margin-top:30px;text-align:center;'>
  	<form action="" id="pageFrom" name="" method="post">
    <table>
    	<tr>
    		<td>
    			授权人：
    		</td>
    		<td>
    			<input type='text' name='sourcepersonname' id='sourcepersonname' style='width:300px;' value='${sourcepersonname}'>
    			<img src="<%=request.getContextPath()%>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('source')" /> 
    			<input type='hidden' name='sourcepersonid' id='sourcepersonid' value='${sourcepersonname}'>
    		</td>
    	</tr>
    	<tr>
    		<td>
    			被授权人：
    		</td>
    		<td>
    			<input type='text' name='targetpersonname' id='targetpersonname' style='width:300px;' value='${targetpersonname}'>
    			<img src="<%=request.getContextPath()%>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('target')" /> 
    			<input type='hidden' name='targetpersonid' id='targetpersonid' value='${targetpersonid}'>
    		</td>
    	</tr>
    	<tr>
    		<td>
    			开始日期：
    		</td>
    		<td>
    			<input type='text' name='begindate' id='begindate' style='width:300px;' class='Wdate' onClick='WdatePicker();' value='${begindate}'>
    		</td>
    	</tr>
    	<tr>
    		<td>
    			结束日期：
    		</td>
    		<td>
    			<input type='text' name='enddate' id='enddate' style='width:300px;' class='Wdate' onClick='WdatePicker();' value='${enddate}'>
    		</td>
    	</tr>
    	<tr>
    		<td colspan='2' style='text-align:center;'>
    			<input type='button' value='确认' onclick='queren()' >
    		</td>
    	</tr>
    </table>
    <input type='hidden' id='rightgiveid' name='rightgiveid' value='${rightgiveid}'>
    </form>
  </body>
</html>
